package uns.fit.gis.contextmenu;

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.Displayable;

import uns.fit.gis.MapDrawer;
import uns.fit.gis.i18n.LocaleManager;
import uns.fit.gis.mapdrawer.ActionCode;
import uns.fit.gis.mapdrawer.MapCanvas;

public class SearchPathContextMenu extends ContextMenu {
	public SearchPathContextMenu() {
		commands = new Command[3];
		commands[0]= new Command(LocaleManager.getMessage("menu"), Command.ITEM, 1);
		commands[1]= new Command(LocaleManager.getMessage("viewlocationsalongpath"), Command.ITEM, 1);
		commands[2] = new Command(LocaleManager.getMessage("exit"), Command.EXIT, 1);
	}
	public void commandAction(Command arg0, Displayable arg1) {
		if(arg0 == commands[0]) {
			MapDrawer.getMidlet().showMenuCanvas();
		}
		else if(arg0 == commands[1]) {
			MapDrawer.getMidlet().mapCanvas.commandAction(ActionCode.SHOW_LOCATIONS_ALONG_PATH);
		}
		else if(arg0 == commands[2]) {
			MapDrawer.getMidlet().mapCanvas.commandAction(ActionCode.DESTROY_APP);
		}
	}

}
